import request from '@/utils/request'

export function getPage(data) {
  return request({
    url: `/crop/page?keyword=${data.keyword}&page=${data.page}&limit=${data.limit}`,
    method: 'get' // query
  })
}

export function addCrop(data) {
  return request({
    url: `/crop/save`,
    method: 'post',
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    data: data // body
  })
}

export function updateCrop(data) {
  return request({
    url: `/crop/update`,
    method: 'post',
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    data: data
  })
}

export function deleteCrop(data) {
  return request({
    url: `/crop/delete/${data.cropId}`,
    method: 'post'
  })
}

export function deleteCrops(data) {
  return request({
    url: `/crop/deleteList?ids%5B%5D=${data.item}`,
    method: 'post'
  })
}
